package com.xmy.cultivate.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.xmy.cultivate.entity.SkillItemsSet;
import com.xmy.cultivate.entity.SkillStations;
import com.xmy.cultivate.service.ISkillStationsService;
import com.xmy.cultivate.util.Code;
import com.xmy.cultivate.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 培训岗位 前端控制器
 * </p>
 *
 * @author hpiggy
 * @since 2025-08-21
 */
@RestController
@RequestMapping("/api/skillStations")
public class SkillStationsController {

    @Autowired
    ISkillStationsService iSkillStationsService;


    @GetMapping ("/findAll")
    public Result findAll(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                          @RequestParam(value = "departmentId", required = false) String departmentId,
                          @RequestParam(value = "status", required = false) String status,
                          @RequestParam(value = "type", required = false,defaultValue = "1") String type
    ) {
        QueryWrapper<SkillStations> qw = new QueryWrapper<>();
        qw.in(StringUtils.isNotBlank(type), "type", type);
        qw.eq("deleted", 0);
        List<SkillStations> skillStationsList = iSkillStationsService.list(qw);

        return new Result(Code.OK,skillStationsList , "查询成功");
    }


}
